CPPFLAGS=-g -Wall -Wstrict-prototypes -pedantic -ansi  $(shell sdl-config --cflags)
LNFLAGS=-lm $(shell sdl-config --libs)

CPP=g++
LN=g++

OBJECT_FILES=main.o Matrix.o Point.o Projection.o Transformation.o
HEADER_FILES=Matrix.h Point.h Projection.h Transformation.h
BUILD_DIR=../build
TARGET=$(BUILD_DIR)/test

ABS_OBJECT_FILES=$(addprefix $(BUILD_DIR)/, $(OBJECT_FILES))

.PHONY: all clean

all: $(TARGET)

$(BUILD_DIR)/%.o: %.cc $(HEADER_FILES)
	$(CPP) $(CPPFLAGS) -c $< -o $@ 

$(TARGET): $(ABS_OBJECT_FILES) $(HEADER_FILES)
	$(LN)  $(LNFLAGS) $(ABS_OBJECT_FILES) -o $(TARGET)

clean:
	for obj in $(ABS_OBJECT_FILES); do  \
	    [ -f $$obj ] && rm $$obj;  \
	done                           
	[ -f $(TARGET) ] && rm $(TARGET)



